package com.gitee.hongruisun.fileupload;

import com.gitee.hongruisun.fileupload.handle.CSVAnalysisHandle;
import com.gitee.hongruisun.fileupload.handle.ExcelAnalysisHandle;
import com.gitee.hongruisun.fileupload.handle.XMLAnalysisHandle;

import java.util.HashMap;
import java.util.Map;

/**
 * 选择策略工厂
 *  单例+工厂+策略
 */
public class AnalysisStrateGyFactory {

    private AnalysisStrateGyFactory(){}
    private static Map ANALYSIS_MAP = new HashMap();
    static{
        ANALYSIS_MAP.put(101,new CSVAnalysisHandle());
        ANALYSIS_MAP.put(102,new ExcelAnalysisHandle());
        ANALYSIS_MAP.put(103,new XMLAnalysisHandle());
    }

    public static AbstractStrategyTemplate getStrategy(Integer key){
        return (AbstractStrategyTemplate) ANALYSIS_MAP.get(key);
    }
}
